@using Blogifier.Shared
@{
    var request = Url.ActionContext.HttpContext.Request;
    var absoluteUrl = $"{request.Scheme}://{request.Host.ToUriComponent()}{request.PathBase.ToUriComponent()}";

    PostModel postModel = (PostModel)Model;
    var post = postModel.Post;

    var postTitle = post.Title;
    var postSlug = absoluteUrl + "/posts/" + post.Slug;

    var share_facebook = "https://www.facebook.com/sharer/sharer.php?u=" + postSlug;
    var share_twitter = "https://twitter.com/intent/tweet?text=" + postTitle + "&url=" + postSlug;
    var share_email =  "mailto:?&subject=" + postTitle + "&cc=&bcc=&body=" + postTitle + "%0" + postSlug;
}

<div class="modal fade share-modal" id="shareModal" tabindex="-1" aria-labelledby="shareModalLabel" aria-hidden="true">
    <div class="modal-dialog modal-dialog-centered">
        <div class="modal-content p-4">
            <div class="modal-header border-bottom-0">
                <h5 class="modal-title" id="shareModalLabel">Share</h5>
                <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
            </div>
            <div class="modal-body share-modal-body">
                <ul class="share-modal-list row g-3">
                    <li class="col">
                        <a class="share-modal-link -facebook" href="@share_facebook" target="_blank">
                            <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-facebook share-modal-link-icon" viewBox="0 0 16 16">
                                <path d="M16 8.049c0-4.446-3.582-8.05-8-8.05C3.58 0-.002 3.603-.002 8.05c0 4.017 2.926 7.347 6.75 7.951v-5.625h-2.03V8.05H6.75V6.275c0-2.017 1.195-3.131 3.022-3.131.876 0 1.791.157 1.791.157v1.98h-1.009c-.993 0-1.303.621-1.303 1.258v1.51h2.218l-.354 2.326H9.25V16c3.824-.604 6.75-3.934 6.75-7.951z"/>
                            </svg>
                            <span class="share-modal-link-label">Facebook</span>
                        </a>
                    </li>
                    <li class="col bft-share-item">
                        <a class="share-modal-link -twitter" href="@share_twitter" target="_blank">
                            <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-twitter share-modal-link-icon" viewBox="0 0 16 16">
                                <path d="M5.026 15c6.038 0 9.341-5.003 9.341-9.334 0-.14 0-.282-.006-.422A6.685 6.685 0 0 0 16 3.542a6.658 6.658 0 0 1-1.889.518 3.301 3.301 0 0 0 1.447-1.817 6.533 6.533 0 0 1-2.087.793A3.286 3.286 0 0 0 7.875 6.03a9.325 9.325 0 0 1-6.767-3.429 3.289 3.289 0 0 0 1.018 4.382A3.323 3.323 0 0 1 .64 6.575v.045a3.288 3.288 0 0 0 2.632 3.218 3.203 3.203 0 0 1-.865.115 3.23 3.23 0 0 1-.614-.057 3.283 3.283 0 0 0 3.067 2.277A6.588 6.588 0 0 1 .78 13.58a6.32 6.32 0 0 1-.78-.045A9.344 9.344 0 0 0 5.026 15z"/>
                            </svg>
                            <span class="share-modal-link-label">Twitter</span>
                        </a>
                    </li>
                    <li class="col bft-share-item">
                        <a class="share-modal-link" href="@share_email" target="_blank">
                            <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-envelope-fill share-modal-link-icon" viewBox="0 0 16 16">
                                <path d="M.05 3.555A2 2 0 0 1 2 2h12a2 2 0 0 1 1.95 1.555L8 8.414.05 3.555zM0 4.697v7.104l5.803-3.558L0 4.697zM6.761 8.83l-6.57 4.027A2 2 0 0 0 2 14h12a2 2 0 0 0 1.808-1.144l-6.57-4.027L8 9.586l-1.239-.757zm3.436-.586L16 11.801V4.697l-5.803 3.546z"/>
                            </svg>
                            <span class="share-modal-link-label">Email</span>
                        </a>
                    </li>
                </ul>
                <input id="pageShareLink" onclick="copyInput('pageShareLink')" onkeydown="copyInput('pageShareLink')" title="click to copy!" type="text" class="share-modal-input" aria-label="Press enter to copy the page link" value="@postSlug" data-link="@postSlug" readonly>
            </div>
        </div>
    </div>
</div>
